home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 37
/
Amiga Format CD37 (1999-02-16)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-03].iso
/
-screenplay-
/
shareware
/
invasionforce
/
source
/
misc
/
makesource.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-01-09
|
963b
|
43 lines
/*
MakeSource.rexx
convert a binary data file into C source suitable for
compiling directly into my program
*/
parse arg filename
if ~open('infile',filename,'r') then do
say "Sorry, can't read" filename "."
exit
end
call open('outfile',"T:OUTPUT",'w')
call open('console','*','w')
count=0;
call writech('outfile',' ')
datum=readch('infile',2)
say "Working..."
call writech('console','')
do while ~eof('infile')
if (count>0) then call writech('outfile',',')
if (count//16==0 & count>0) then do
call writeln('outfile','')
call writech('outfile',' ')
call writech('console',' ')
end
mystring='0x'||C2X(datum)
call writech('outfile',mystring)
count=count+2
datum=readch('infile',2)
end
call close('infile')
call close('outfile')
call close('console')
say ''
address command "copy T:OUTPUT to" filename'.CX'
address command "delete >nil: T:OUTPUT"
exit
/* end of listing */